import { get,post } from "./http";
import { ResponseType,ResponseType2,ResponseType3 } from "./utils/utils";
import apiUrl from './apiUrl'
// 查询树型菜单
export function getTreeList() {
  return get<ResponseType2>(apiUrl.treeList);
}
// 查询分类素材列表materialList
export function getMaterialList(data:any) {
  return get<ResponseType>(apiUrl.materialList,data);
}
// 获取素材详情materialdetai
export function getMaterialdetai(id:number) {
  return get<ResponseType>(apiUrl.materialdetai+"/"+id);
}
// 授权列表
export function getauthTypeList(id:number) {
  return get<ResponseType2>(apiUrl.authTypeList+"?type="+id);
}
// // 查询视频规格materialdetail
// export function getauthTypeList(id:number) {
//   return get<ResponseType>(apiUrl.authTypeList+"?type="+id);
// }
// checkCollect是否收藏过
export function checkCollectId(id:number) {
  return get<ResponseType3>(apiUrl.checkCollect+"/"+id);
}
// collectAdd collectDel
export function collectAdd(id:number) {
  return post<ResponseType>(apiUrl.collectAdd,{ spuId: id });
}
export function collectDel(id:number) {
  return get<ResponseType>(apiUrl.collectDel,{spuId:id});
}
// 素材规格materialdetail
export function materialdetail(id:number) {
  return get<ResponseType>(apiUrl.materialdetail+"/"+id);
}
// 检查规格是否有下载权限
export function checkPermissions(id:number,marterialDetailId:number) {
  return get<ResponseType3>(apiUrl.checkPermissions+"/"+marterialDetailId,{priceId:id});
}
// getPrice
export function getPrice(id:number,authTypeId:string) {
  return get<ResponseType>(apiUrl.getPrice,{materialId:id,authTypeId:authTypeId});
}
// 下载素材downloadDetail
export function downloadDetail(detailId:number,priceId:number,machineCode:string) {
  return get<any>(apiUrl.downloadDetail,{detailId:detailId,priceId:priceId,machineCode:machineCode});
}
// detailConfig
export function getdetailConfig() {
  return get<any>(apiUrl.detailConfig);
}